package ngamejava2;

import java.io.IOException;
import javax.xml.xpath.XPathExpressionException;
import org.w3c.dom.Node;

public class ParallaxGamePlane extends GamePlane
{
	private float distance;

	public ParallaxGamePlane()
	{
		this(1);
	}

	public ParallaxGamePlane(float distance)
	{
		this.distance = distance;
	}

	public float getDistance()
	{
		return distance;
	}

	public void setDistance(float distance)
	{
		this.distance = distance;
	}

	@Override
	public void write(GameWriter gw) throws IOException
	{
		super.write(gw);
		gw.write("distance", distance);
	}

	@Override
	public void read(GameReader gr, Node objectNode) throws XPathExpressionException
	{
		super.read(gr, objectNode);
		distance = gr.readFloat(objectNode, "float[@name='distance']");
	}
}